
export function getTreeData(list, n = 0) {
  let result = []

  list.forEach(val => {
    if (val.pid == n) {
      let data = {
        id: val.id,
        label: val.title,
      }
      var L = getTreeData(list, val.id)
      if (L.length > 0) {
        data.children = L
      }
      result.push(data)
    }

  })
  return result
}